package model;

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;

public class Artist {

	private String name;
	private Set<Album> albums = new LinkedHashSet<Album>();
	private Set<Credit> credits = new LinkedHashSet<Credit>();

	public Artist() {
	}

	public Artist(String name, Collection<Album> albums, Collection<Credit> credits) {
		super();
		this.name = name;
		setAlbums(albums);
		setCredits(credits);
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Set<Album> getAlbums() {
		return albums;
	}
	public void setAlbums(Collection<Album> albums) {
		this.albums.clear();
		if (albums != null) {
			this.albums.addAll(albums);
		}
	}
	public void addAlbum(Album album) {
		albums.add(album);
	}
	public Set<Credit> getCredits() {
		return credits;
	}
	public void setCredits(Collection<Credit> credits) {
		this.credits.clear();
		if (credits != null) {
			this.credits.addAll(credits);
		}
	}
	public void addCredit(Credit credit) {
		credits.add(credit);
	}

	@Override
	public String toString() {
		StringBuffer line = new StringBuffer();
		line.append("ArtistDto [name:");
		line.append(name);
		line.append(", albums:");
//		line.append(albums);
		line.append(", credits:");
//		line.append(credits);
		line.append("]");
		return line.toString();
	}
}
